﻿var oneArray = [];
var scripts = oneArray;
//var numArray = [];
//var scripts2 = numArray;

// This function pushes new elements inserted by user into array oneArray
function funcOne() {
    "use strict";
    var firstCheck = document.getElementById("firstInput").value;
    var secondCheck = document.getElementById("secondInput").value;
    if (firstCheck.length !== 0) {
        oneArray.push(firstCheck.value);
        firstCheck.innerHTML += scripts[scripts.length - 1];
        firstCheck.value = ""; //used to clear the input box
    } else if (secondCheck.length !== 0) {
        oneArray.push(secondCheck.value);
        secondCheck.innerHTML += scripts[scripts.length - 1];
        secondCheck.value = ""; //used to clear the input box
    } else {
        alert("you messed up!")
        return false;
    }
}
// This function calls the alert for every element in the array
function funcTwo() {
    "use strict";
    for (i = 0; i < scripts.length; i++) {
        alert(scripts[i]);
    }
}
// This function displays all the elements of the array into div id question2
function funcThree() {
    "use strict";
    for (var i = 0; i < scripts.length; i++) {
        var myVar = scripts[i] + "\n";
        document.getElementById("question2").innerHTML += myVar;
    }
}
// This function pushes Odd elements inserted by user into div
function funcFour() {
    "use strict";
    for (var i = 0; i < scripts.length; i++) {
        if (scripts[i] % 2) {
            var myVar = scripts[i] + "\n";
            document.getElementById("question2").innerHTML += myVar;
        }
    }
}
function funcFive() {
    "use strict";
    oneArray.splice(1, 1);
}
function funcSix() {
    "use strict";
    var typeCheck = document.getElementById("firstInput").value;
    if (typeof typeCheck !== "string" || typeCheck === "") {
        return "Please enter a string";
    }
    else {
        return typeCheck.split("").reverse().join("");
    }
};